package tcm.test.pojo.entity;

import lombok.Data;

@Data
public class result<T> {

    private Integer code; //编码：1成功，0和其它数字为失败
    private String msg; //错误信息
    private T data; //数据

    public static <T> result<T> success() {
        result<T> result = new result<T>();
        result.code = 1;
        return result;
    }

    public static <T> result<T> success(T object) {
        result<T> result = new result<T>();
        result.data = object;
        result.code = 1;
        return result;
    }

    public static <T> result<T> error(String msg) {
        result result = new result();
        result.msg = msg;
        result.code = 0;
        return result;
    }

}